package kr.co.mcshop.qna;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class QnAService {

	@Autowired
	private SqlSession sqlSession;

	public List<QnA> selectqna(Map map) {
		QnAMapper mapper = sqlSession.getMapper(QnAMapper.class);
		return mapper.selectqna(map);
	}

	public int insertqna(Map map) {
		QnAMapper mapper = sqlSession.getMapper(QnAMapper.class);
		return mapper.insertqna(map);
	}

	public int updateqna(Map map) {
		QnAMapper mapper = sqlSession.getMapper(QnAMapper.class);
		return mapper.updateqna(map);
	}

	public int deleteqna(Map map) {
		QnAMapper mapper = sqlSession.getMapper(QnAMapper.class);
		return mapper.deleteqna(map);
	}

	public int updateReadCount(Map map) {
		QnAMapper mapper = sqlSession.getMapper(QnAMapper.class);
		return mapper.updateReadCount(map);
	}

	public List<QnA> searchtitle(Map map) {
		QnAMapper mapper = sqlSession.getMapper(QnAMapper.class);
		return mapper.searchtitle(map);
	}	
	public List<QnA> searchuserid(Map map) {
		QnAMapper mapper = sqlSession.getMapper(QnAMapper.class);
		return mapper.searchuserid(map);
	}
	
}
